--[[
函数11：lua_video_get_duration
功能：取得某个文档生成时间duration、生成进度progress、预估渲染时间estimate
参数：ARGV[1]:doc_id:23
参数：ARGV[2]:current_time:21325648
返回：按以下顺序返回数组：
        duration
        progress
        estimate
-- ]]--


local PREFIX_DOC = "doc_id_"
local key = PREFIX_DOC..ARGV[1]
local current_time = tonumber(ARGV[2]) or 0
local start_time = tonumber(redis.call("hget",key,"start_time")) or current_time
local d = current_time - start_time
redis.call("hset",key,"duration",d)
--创建返回结果表
local res = {}
table.insert(res,d)
local progress = redis.call("hget",key,"progress")
table.insert(res,progress)
local estimate = redis.call("hget",key,"estimate")
table.insert(res,estimate)

return res